<?php
// +----------------------------------------------------------------------
// | xiongrui [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.xiongrui.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.xiongrui.cn>
// +----------------------------------------------------------------------

namespace app\work\controller;
use \think\Controller;

class Index extends controller {

	public function index() {
    $corpid = 'wwe8857dbaeeda1ec4';
    $corpsecret = 'la0ObOTvrQhsTIA_3vchvO7X-P_XawZp0wamfYPEV0Q';
    $url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={$corpid}&corpsecret={$corpsecret}";
    $getInfo = http_get($url);
    $info = json_decode($getInfo, true);
    $token = $info['access_token'];

print_r($token);
    $sendUrl = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={$token}";
    $data['touser'] = 'XiongRui';
    $data['msgtype'] = 'text';
    $data['agentid'] = '1000002';
    $data['text']['content'] = "用户熊锐于2018年3月27日下单，<a href=\"http://work.weixin.qq.com\">查询详情</a>";
    $sendInfo =  http_post($sendUrl, json_encode($data));
 print_r($sendInfo);
	}







}
